package hbasecli.resp;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Resp<T> {
    private long code;
    private String msg = "";
    private T data;

    public static <T> Resp<T> of(long code, String msg, T data) {
        Resp<T> resp = new Resp<>();
        resp.code = code;
        resp.msg = msg;
        resp.data = data;
        return resp;
    }

    public static <T> Resp<T> failure(String msg) {
        return of(500L, msg, null);
    }

    public static <T> Resp<T> success(T data) {
        return of(200L, "", data);
    }
}
